package com.ny.zmb.openapi.jh.controller;

import com.alibaba.fastjson.JSONObject;
import com.ny.zmb.openapi.controller.entity.Result;
import com.ny.zmb.openapi.jh.from.JHAddressFrom;
import com.ny.zmb.openapi.jh.service.JHAddressService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RequestMapping("jh/address")
@RestController
public class JHAddressController {

    /**
     * 获取地址列表
     * @param id
     * @return
     */
    @GetMapping("list")
    public Result list(Integer id){
        List<JHAddressFrom> address = JHAddressService.getAddress(id);
        return Result.ok(address);
    }

    /**
     * 地址详情转换地址编码
     * @param address
     * @return
     */
    @GetMapping("address")
    public Result address(String address){
        JSONObject result = JHAddressService.getCode(address);
        return Result.ok(result);
    }
}
